<{include file="_head.html"}>
<script type="text/javascript" src="js/example.js"></script>
<script type="text/javascript" src="js/jquery.qqFace.js"></script> 
<!-- 弹框 -->
<link rel="stylesheet" type="text/css" href="css/jquery.fancybox-1.3.4.css" media="screen" />
<script type="text/javascript" src="js/jquery.fancybox-1.3.4.js"></script>
<{include file="js.html"}>

<script type="text/javascript">
 $(document).ready(function() {
         $(".various1").fancybox({
            'titlePosition':'inside',
            'transitionIn':'none',
            'transitionOut':'none'
        });

    });
$(function(){
    //显示隐藏logo
    $(window).scroll(function () {
        var top= $(window).scrollTop();
        if(top>=200){
            $("#topLogo").show();
        }else{
            $("#topLogo").hide();
        }
    })

    //登录注册
    $('input[name="ePhone"]').blur(function(){
        var data=$(this).val();
        $(".j_logn_n5").hide();
        if(data!=''){
            var pattern_email = /^\w+@[a-z0-9\-]+\.[a-z]+(\.[a-z]+)?$/i;
            var pattern_phone = /^((13[0-9])|(15[0-9])|147|(18[0-35-9]))\d{8}$/;
            if(pattern_email.test(data)){
                 $.post(
                    "ajax.php?action=checkUserEmail",
                    {data:data},
                    function(data){
                        if(data.res==1){
                            $(".regSign").val('登录');
                            $(".regSign").attr("qubie",'signEmail');
                        }else{
                            $(".regSign").val('注册');
                            $(".regSign").attr("qubie",'regEmail');
                        } 
                        $('input[name="pwd"]').show();
                    },'json'
                );
            }else{
                if(pattern_phone.test(data)){
                   $.post(
                        "ajax.php?action=checkUserPhone",
                        {data:data},
                        function(data){
                            if(data.res==1){
                                $(".regSign").val('登录');
                                $(".regSign").attr("qubie",'signPhone');
                            }else{
                                $(".shouji").show();
                                $(".regSign").val('注册');
                                $(".regSign").attr("qubie",'regPhone');
                            } 
                            $('input[name="pwd"]').show();
                        },'json'
                    );

                }else{
                    alert('请填写合法的邮箱或手机号！');
                }
            } 
        }else{
            $('input[name="pwd"]').hide(); 
            $(".regSign").val('登录/注册');
        }
    })

    //发送验证码
    $("#fasong").click(function(){
        var phone=$('input[name="ePhone"]').val();
        var obj=$(this);
        $.post(
            "ajax.php?action=postMobile",
            {phone:phone},
            function(data){
                if(data.error==1){
                    //alert("发送成功!");
                    obj.val("发送中...");
                }else{
                    return false;
                } 
            },'json'
        );
    })

    //点击登录注册
    $(".regSign").click(function(){
        $(".j_logn_n5").hide();
        var qubie=$(this).attr("qubie");
        var data=$('input[name="ePhone"]').val();
        var pwd=$('input[name="pwd"]').val();
        if(qubie==''){
            $(".error9").show();
            return false;
        }
        if(pwd==''){
             $(".error8").show();
            return false;
        }
        var code=$('input[name="code"]').val();
        var send=$("#sendEmail").html();
        alert(send);
       $.post(
        'dologin.php?action=regLogin',
        {qubie:qubie,data:data,pwd:pwd,code:code},
        function(data){
            if(data.error=='5'){
                alert(data.msg);
                $("#fancybox-content").html(send);
            }
            if(data.error=='0'){
                alert(data.msg);
                window.location.href="index.php";
            }
            if(data.error=='1'){
                 $(".error1").show();
                 return false;
            }
        },'json'
        )
       
    })  

    //搜索
    $(".btn01").click(function(){
        var types=$(".search_types").val();
        var url=types=='info'?'info_list.php':'service_list.php';
        var title=$("[name=title]").val();
        window.location.href=url+"?title="+title;
        // $("#mySearch").attr("action",url);
        // $("#mySearch").submit();
    })
})

function $$$$$(_sId){
    return document.getElementById(_sId);
 }

function hide(_sId){
    $$$$$(_sId).style.display = $$$$$(_sId).style.display == "none" ? "" : "none";
}
function pick(v,id) {
    document.getElementById('am').value=v;
    // document.getElementById('am').value=id;
    $(".search_types").val(id);
    hide('HMF-1')
}
function bgcolor(id){
    document.getElementById(id).style.background="#F7FFFA";
    document.getElementById(id).style.color="#000";
}
function nocolor(id){
    document.getElementById(id).style.background="";
    document.getElementById(id).style.color="#788F72";
}

window.onload = function(){
    $$$$$("am").onmouseover = function(){
        window.onclick = null;
    }
    $$$$$("am").onmouseout = function(){
        window.onclick = function(){
            $$$$$("HMF-1").style.display = "none";
        }
    }
}

</script>
<!--评论JS-->
<script type="text/javascript">
$(function(){
    //匹配表情-初始化
    $('.neirong').each(function(){
        var text=$(this).html();
        $(this).html(replace_em(text));
    })

    //显示对应评论(小编说的评论)
    $(".look_pl").click(function(){
        var sort=$(this).attr("sort");//排序
        $(".index_hf").hide();
        $(".index_hf").eq(sort).show();
    })
    //显示回复框(回复小编说)
    $(".hf").click(function(){
        var sort=$(this).attr("sort");//排序
        $(".jsy_hfk").hide();
        $(".jsy_hfk").eq(sort).show();
        //重置样式+默认设置
        $(".hfr").eq(sort).hide();
        $(".reply_id").val('0');
        $(".user_type").val('admin');

    })

    //点击单独回复
    $(".dan_hf").live('click',function(){
        var sort=$(this).parent().parent().attr("sort");//排序
        var name=$(this).attr("name");//回复名称
        var reply_id=$(this).attr("reply_id"); //需回复ID
        var user_type=$(this).attr("user_type");//被回复人类型

        $(".jsy_hfk").hide();           //评论框
        $(".jsy_hfk").eq(sort).show();  //评论框
        //回复人信息
        $(".hfr").eq(sort).show();
        $(".hfr").eq(sort).html('in reply to '+name); //展示
        $(".reply_id").val(reply_id);                 //被回复人
        $(".user_type").val(user_type);               //回复的类型 

    })

    //提交评论
   $(".tj").click(function(){
        var id=$(this).attr("id");                    //小编说编号       
        var sort=$(this).attr("sort");                //排序
        var comment=$(".jsy_hfk1").eq(sort).val();    //评论内容
        var reply_id=$(".reply_id").val();            //需回复ID
        var user_type=$(".user_type").val();          //回复的类型

        $.post(
            'index.php?action=comment',
            {id:id,comment:comment,reply_id:reply_id,user_type:user_type},
            function(data){
              if(data.error==1){
                 alert(data.mes);
                 //写入样式
                 $(".index_hf").eq(sort).prepend(data.html);
                 //显示评论列表
                 $(".index_hf").eq(sort).show();
                 //替换表情
                 var text=$(".index_hf").eq(sort).children(".j_tctk_hf").find(".neirong").eq(0).html();
                 $(".index_hf").eq(sort).children(".j_tctk_hf").find(".neirong").eq(0).html(replace_em(text));

                 //重置样式
                 $(".hfr").eq(sort).hide();     //回复展示信息
                 $(".reply_id").val('0');       //回复人
                 $(".user_type").val('admin');  //回复类型
                 $(".jsy_hfk1").eq(sort).val(''); //回复内容 
              }else{
                alert("请先登录！");
                window.location.href="login.php";
              }
        },"json")
   })

    //表情特效
    for (var i = 0; i < '<{$commentNum}>'; i++) {
        $('.emotion'+i).qqFace({ // 
          id : 'facebox'+i, //表情盒子的ID
          assign:'saytext'+i, //给那个控件赋值
          path:'images/face/' //表情存放的路径，注意如果修改了这个地方，下面正则匹配的地方也要做相应的修改
        });
    };

}) 

    //表情替换
    function replace_em(str){
        str = str.replace(/\</g,'&lt;');
        str = str.replace(/\>/g,'&gt;');
        str = str.replace(/\n/g,'<br/>');
        str = str.replace(/\[em_([0-9]*)\]/g,'<img src="images/face/$1.gif" border="0" />');
        return str;
    }
    
</script>
<!--评论JS-->

<body>

<!--top-开始-->
<div class="j_top">
	<div class="j_topn" style="display:none;">
    	<a href="index.php"  class="j_topn1_logo"><img src="images/sy/sy_02.png" /></a>
        <div class="j_topny">
            <span class="j_topny_ss">
                <input type="text" class="sr" onclick="if(this.value=='输入搜索内容...'){this.value=''}" value="输入搜索内容..." />
                <input type="button" class="btn012" align="right" /></input>
            </span>
            
            <span class="j_top_dz">
            	<a href="#" class="j_top_dz1">登录</a>|<a href="#" class="j_top_dz1">注册</a>
            </span>
            <a href="#" class="j_top_dzy"><img src="images/sy/sy_01.png" /></a>
        </div>
    </div>
    
    <!--登录号-开始-->
	<div class="j_topn" >
    	<a href="index.php" id="topLogo" style="display:none;" class="j_topn1_logo"><img src="images/sy/sy_02.png" /></a>
        <div class="j_topny">
        <!-- <form method="get" id="Search"> -->
          <span class="j_topny_ss">
            <samp class="ss">
                <input onclick="hide('HMF-1')" type="text" value="资讯" id="am" class="am" />
                <div id="HMF-1" style="display: none " class="bm"> 
                    <span id="a1" onclick="pick('资讯','info')" onMouseOver="bgcolor('a1')" onMouseOut="nocolor('a1')" class="cur">资讯</span> 
                    <span id="a2" onclick="pick('服务','service')" onMouseOver="bgcolor('a2')" onMouseOut="nocolor('a2')" class="cur">服务</span> 
                </div>
                <input type="text" class="sr" name="title" onclick="if(this.value=='输入搜索内容...'){this.value=''}" value="输入搜索内容..." />
                <input type="button" class="btn01" align="right" /></input>
                <input name="types" class="search_types" type="hidden" value="info"/>
            </samp>
            </span>
       <!--  </form> -->
            <{if $user_id!=''}>
           	<a href="#" class="j_top_dz1"><img src="images/sy/sy_04.png" />消息<span>4</span></a>
            <span class="j_top_dz">
            	<a href="javascript:;" class="j_top_dzy_h"><img src="./upload/user/small/<{$user.avatar}>" /></a>
                <div class="j_top_dztk">
                	<span class="j_top_dztks">
                    	<a href="my_account.php" class="j_top_dztksz"><img src="./upload/user/small/<{$user.avatar}>" /></a>
                        <span class="j_top_dztksy"><{$user.account}></span>
                    </span>
                    <a href="user_main.php?type=user" class="j_top_dztkx j_top_dztkx_hov">我的主页</a>
                    <a href="my_collect_info.php" class="j_top_dztkx">我的收藏</a>
                    <a href="my_collect_service.php" class="j_top_dztkx">我关注的服务</a>
                    <a href="info_apply.php" class="j_top_dztkx">向子时投稿</a>
                    <a href="my_account.php" class="j_top_dztkx">账号设置</a>
                    <a href="javascript:;" onclick="out();" class="j_top_dztkx">退出</a>
                </div>
            </span>
            <{else}>
             <span class="j_top_dz">
                <!-- <a href="#" class="j_top_dz1"></a> --><a href="#inline2" class="j_top_dz1 various1">登录/注册</a>
            </span>
            <a href="#" class="j_top_dzy "><img src="images/sy/sy_01.png" /></a>
            <{/if}>
        </div>
    </div>
    <!--登录号-结束-->
</div>
<!--top-结束-->

<!--导航-nav-开始-->
<div class="j_nav">
	<div class="j_navn">
    	<a href="#" class="j_nav_logo"><img src="images/sy/sy_03.png" /></a>
        <div class="j_navnr">
        	<a href="index.php" class="j_navnr1 j_navnr1_hov">首页</a>
            <span class="j_navnr2">
            	<a href="#" class="j_navnr1">资讯<img src="images/sy/sy_06.png" /></a>
                <ul  class="j_navnr21">
                    <{foreach item=res from=$info_class}>
                	<li><a href="info_list.php?class_id=<{$res.id}>"><{$res.class_name}></a></li>
                    <{/foreach}>
                	<!-- <li><a href="#">资讯列表</a></li>
                	<li><a href="#">资讯列表</a></li>
                	<li><a href="#">资讯列表</a></li> -->
                </ul>
            </span>
        	<a href="service_list.php" class="j_navnr1">子时服务</a>
        	<a href="about_us.php" class="j_navnr1">关于子时</a>
        </div>
    </div>
</div>
<!--导航-nav-结束-->

<!--banner-开始-->
<div class="sy_banner"></div>
<!--banner-结束-->

<!--主体内容-开始-->
<div class="j_sy_main">
	<div class="j_sy_mainz">
		<div class="j_sy_mainz">
        	<!-- <a href="#" class="j_sy_mainzt1 j_sy_mainzt11">全部</a>
             <{foreach item=res from=$info_class}>
        	<a href="info_list.php?class_id=<{$res.id}>" class="j_sy_mainzt1"><{$res.class_name}></a>
            <{/foreach}> -->
            <div class="nav-wrap">
                <ul class="group" id="example-one">
                  <li <{if $smarty.get.class_id==''}> class="current_page_item" <{/if}>><a  href="info_list.php">全部</a></li>
                <{foreach item=loop from=$info_class}>
                  <li <{if $smarty.get.class_id==$loop.id}> class="current_page_item" <{/if}> ><a  href="info_list.php?class_id=<{$loop.id}>"><{$loop.class_name}></a></li> 
                <{/foreach}>
                </ul>
            </div>
        	
        </div>
        <{foreach item=res from=$row.one}>
        <div class="jsy_gzlnzn">
        	<span class="gzbrk"><img width="300" height="200" src="./upload/info/small/<{$res.thumbnail}>" /></span>
        	<div class="gzbrky">
            	<span class="gzbrkys"><a href="info_detail.php?id=<{$res.id}>"><{$res.title}></a></span>
                <span class="gzbrkyc"><{$res.intro|truncate:120}></span>
                <span class="gzbrkyx"><a href="info_detail.php?id=<{$res.id}>">more &gt;&gt;</a></span>
                <div class="gzbrkyb">
                	<span class="gzbrkybz"><{$res.className}></span>
                    <span class="gzbrkyby">
                    	<a href="#" class="gzbrkyby1"><{$res.click_num}></a>
                    	<a href="#" class="gzbrkyby2"></a>
                    	<a href="#" class="gzbrkyby3"></a>
                    	<!-- <a href="#" class="gzbrkyby4"></a> -->
                    </span>
                </div>
            </div>
        </div>
        <{/foreach}>

        <{if $nowNum>0}>
    	<div class="j_gzlnzt"><span class="sy_grkd"><{$now_time}></span></div>
        <{/if}>

       <{foreach item=res from=$row.two}>
        <div class="jsy_gzlnzn">
            <span class="gzbrk"><img width="300" height="200" src="./upload/info/small/<{$res.thumbnail}>" /></span>
            <div class="gzbrky">
                <span class="gzbrkys"><a href="info_detail.php?id=<{$res.id}>"><{$res.title}></a></span>
                <span class="gzbrkyc"><{$res.intro|truncate:120}></span>
                <span class="gzbrkyx"><a href="info_detail.php?id=<{$res.id}>">more &gt;&gt;</a></span>
                <div class="gzbrkyb">
                    <span class="gzbrkybz"><{$res.className}></span>
                    <span class="gzbrkyby">
                        <a href="#" class="gzbrkyby1"><{$res.click_num}></a>
                        <a href="#" class="gzbrkyby2"></a>
                        <a href="#" class="gzbrkyby3"></a>
                        <!-- <a href="#" class="gzbrkyby4"></a> -->
                    </span>
                </div>
            </div>
        </div>
        <{/foreach}>

       
<!--        
        <div class="j_fy">
            <a href="#" class="j_fy1">上一页</a>
            <a href="#" class="j_fy1">1</a>
            <a href="#" class="j_fy1 j_fy11">2</a>
            <a href="#" class="j_fy1">3</a>
            <a href="#" class="j_fy1">4</a>
            <a href="#" class="j_fy1">下一页</a>
        </div>
            
-->
    </div>


    <div class="j_sy_mainy">
    	<div class="j_sy_mainyn">
        	<span class="j_sy_mainynt">吐槽调侃</span>
            <input type="hidden" class="reply_id" value="0"/>
            <input type='hidden' name='user_type' class="user_type" value="admin" />

            <{foreach item=loop key=key from=$comment}>
            <div class="j_tctk">
            	<span class="j_tctkz"><img src="images/sy/sy_16.png" /></span>
                <div class="j_tctky">
                	<span class="j_tctky1"><{$loop.topic}></span>

                     <div class="index_hf" style="display:none;" sort="<{$key}>">

                     <{foreach item=reply from=$loop.reply}> 
                     <span class="j_tctk_hf">
                     <a href="user_main.php?type=<{$reply.type}>&id=<{$reply.user_id}>"><{$reply.userName}></a>：<{if $reply.reply_id>0}>回复&nbsp;@<a href="user_main.php?type=<{$reply.reply_type}>&id=<{$reply.reply_id}>"><{$reply.replyName}></a>：<{/if}>
                     <span class="neirong"><{$reply.comment}></span>&nbsp;&nbsp;<a href="javascript:;" class="dan_hf" style="float:right"  name="<{$reply.userName}>" reply_id="<{$reply.user_id}>" user_type="<{$reply.type}>">回复 </a></span>
                     <{/foreach}>
                     <a href="topic_list.php?id=<{$loop.id}>" >查看更多>></a>
                     </div>

                    <span class="j_tctky2">
                    	<a href="javascript:;" class="j_tctky21 look_pl" sort="<{$key}>">查看评论</a>
                    	<a href="javascript:;" class="j_tctky21 hf" sort="<{$key}>">回复</a>
                        <span class="jsy_hfk" style="display:none;">
                            <span class="hfr" style="display:none;"></span>
                            <a href="javascript:;" class="emotion<{$key}>">表情</a>
                        	<textarea name="comment" cols="" rows="" class="jsy_hfk1 " id="saytext<{$key}>"></textarea>
                            <span class="jsy_hfk2"><a href="javascript:;" id="<{$loop.id}>" class="tj" sort="<{$key}>">提交</a></span>
                        </span>
                    </span>

                </div>
            </div>
            <{/foreach}>    

            <div class="j_wztg">
            	<span class="j_wztgn"><a href="info_apply.php">文章投稿&gt;&gt;</a></span>
            </div>
            
        </div>
    </div>
</div>
<!--主体内容-结束-->

<{include file="footer.html"}>